<div class="lista-tarefas">
        <h3>Tarefas por usuário</h3>
        <div>
            <table>
                <thead>
                    <tr>
                        <th scope="col">Ref.</th>
                        <th scope="col">Funcionário</th>
                        <?php /*
                        <th scope="col">Horas</th>
                        */?>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $i = 0;
                    foreach ($this->aHorasPorMes as $aHoras) {
                        $class = ($i++ % 2 == 0) ? '' : ' class="cor"';
                    ?>
                        <tr<?php echo $class; ?>>
                            <td><?php echo $aHoras->ref; ?></td>
                            <td>
                                <?php echo $aHoras->st_nome; ?>
                            </td>
                            <?php /*
                            <td><?php echo $aHoras->st_horas; ?></td>
                            */ ?>
                        </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>

        <div id="grafico-projetos" style="width: 800px; height: 400px; margin: 0 auto"></div>

        <h3>Horas por projeto</h3>
        <div>
            <table>
                <thead>
                    <tr>
                        <th scope="col">Projeto</th>
                        <?php /*
                        <th scope="col">Horas</th>
                        */ ?>
                        <th scope="col">Qt Tarefas</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $i = 0;
                    foreach ($this->aHorasPorProjeto as $aHoras) {
                        $class = ($i++ % 2 == 0) ? '' : ' class="cor"';
                    ?>
                        <tr<?php echo $class; ?>>
                            <td><?php echo $aHoras->st_nome; ?></td>
                            <?php /*
                            <td><?php echo $aHoras->qt_horas; ?></td>
                            */ ?>
                            <td><?php echo $aHoras->qt_tarefas; ?></td>
                        </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>

        <h3>Atividades</h3>
        <div>
            <table>
                <thead>
                    <tr>
                        <th scope="col">Tarefa</th>
                        <th scope="col">Data</th>
                        <?php /*
                        <th scope="col">Horas</th>
                        */ ?>
                        <th scope="col">Atividade</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $i = 0;
                    foreach ($this->aAtividades as $aHoras) {
                        $class = ($i++ % 2 == 0) ? '' : ' class="cor"';
                    ?>
                        <tr<?php echo $class; ?>>
                            <td><?php echo $aHoras->fk_tarefa; ?></td>
                            <td nowrap="nowrap"><?php echo $this->dateFormat($aHoras->dt_cadastro, 'd/m/Y H:i:s'); ?></td>
                            <?php /*
                            <td><?php echo $aHoras->qt_horas; ?></td>
                            */ ?>
                            <td><?php echo nl2br($aHoras->st_atividade); ?></td>
                        </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
<?php /*
        <h3>Horas por dia</h3>
        <div>
            <table>
                <thead>
                    <tr>
                        <th scope="col">Ref.</th>
                        <th scope="col">Horas</th>
                    </tr>
                </thead>
                <tbody>
                    <?php
                    $i = 0;
                    foreach ($this->aHorasPorDia as $aHoras) {
                        $class = ($i++ % 2 == 0) ? '' : ' class="cor"';
                    ?>
                        <tr<?php echo $class; ?>>
                            <td><?php echo $aHoras->ref; ?></td>
                            <td><?php echo $aHoras->st_horas; ?></td>
                        </tr>
                    <?php } ?>
                </tbody>
            </table>
        </div>
*/ ?>
</div>


<script type="text/javascript" src="<?php echo $this->baseUrl(); ?>/js/highcharts/highcharts.js"></script>
<script type="text/javascript" src="<?php echo $this->baseUrl(); ?>/js/highcharts/modules/exporting.js"></script>
<?php
$aGrafico = array();
foreach ($this->aGrafico as $dado) {
    $aGrafico[] = '"' . $dado->st_nome . '", ' . round($dado->qt_horas_percentual, 2);
}
$st_projetos =  "[" . implode("],[", $aGrafico) . "]";
?>
<script type="text/javascript">
var chart;
$(document).ready(function() {
   chart = new Highcharts.Chart({
      chart: {
         renderTo: 'grafico-projetos',
         plotBackgroundColor: null,
         plotBorderWidth: null,
         plotShadow: false
      },
      title: {
         text: 'Horas trabalhadas por projeto'
      },
      tooltip: {
         formatter: function() {
            return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
         }
      },
      plotOptions: {
         pie: {
            allowPointSelect: true,
            cursor: 'pointer',
            dataLabels: {
               enabled: true
            },
            showInLegend: true
         }
      },
       series: [{
         type: 'pie',
         name: 'Browser share',
         data: [
            <?php echo $st_projetos; ?>
         ]
      }]
   });
});
</script>